//
//  StageScene+State.swift
//  Loop
//
//  Created by remy on 2021/10/20.
//

import SpriteKit

extension StageScene {
    func readyLabelNode(text: String? = nil, name: String? = nil) -> SKLabelNode {
        let label = SKLabelNode(fontName: "AvenirNext-Medium", fontSize: 20.0, fontColor: CC.ID6_1.color, text: text)
        label.name = name
        return label
    }
    
    func loadReadyUI(gameOver: Bool = false) {
        let wrap = SKSpriteNode(color: CC.ID4_4.color, size: UIScreen.size)
        wrap.name = "readyWrap"
        wrap.anchorPoint = .zero
        wrap.position = .zero
        self.addChild(wrap)
        let newGame = readyLabelNode(name: "newGame")
        newGame.position = CGPoint(x: self.frame.midX, y: self.frame.midY - 70.0)
        wrap.addChild(newGame)
        let loadGame = readyLabelNode(text: "load_game".localized, name: "loadGame")
        loadGame.position = CGPoint(x: self.frame.midX, y: self.frame.midY - 120.0)
        wrap.addChild(loadGame)
        if gameOver {
            wrap.color = UIColor(CC.ID4_4, 0.4)
            newGame.text = "restart_game".localized
        } else {
            newGame.text = "new_game".localized
        }
    }
    
    func loadPlayUI() {
        let wrap = SKSpriteNode(color: CC.ID0_22.color, size: UIScreen.size)
        wrap.name = "playWrap"
        wrap.anchorPoint = .zero
        wrap.position = .zero
        self.addChild(wrap)
    }
    
    func gameResume() {
        
    }
    
    func gamePause() {
        
    }
}
